#ifndef FADER_H
#define FADER_H

#include <QObject>
#include "qtimer.h"

class Fader : public QObject
{
   Q_OBJECT
public:
   explicit Fader(QObject *parent = 0);

   void startFrom( int startVolume);
   void stop();

   void toggleFrom( int startVolume);

protected:
   virtual bool isFadeComplete() = 0;

private:
   QTimer m_volumeUpdateTimer;
   bool   m_isFading;

protected:
   qreal m_volume;

signals:
   void changeVolume( int );

protected slots:
   virtual void onVolumeUpdateTick() = 0;

};

#endif // CFADER_H
